package com.sylli.oeuf.server.object.transferable;

import java.util.ArrayList;
import java.util.List;

public class PostBattleResponseTO extends PostResponseTO {

	/**
	 * 
	 */
	private static final long serialVersionUID = 5845984842363056596L;
	
	private CharacterPostDataTO postData;
	
	private List<String> log = new ArrayList<String>();
	
	public final static String LOG_KEY_WORD_BATTLE_PLAYER_EVENT = "$p";
	
	public final static String LOG_KEY_WORD_BATTLE_MONSTER_EVENT = "$m";
	
	public final static String LOG_KEY_WORD_BATTLE_ACHIEVEMENT = "$a";

	public PostBattleResponseTO() {
		// for flex
	}
	
	@Override
	public boolean equals(Object obj) {
		if (obj instanceof PostBattleResponseTO) {
			PostBattleResponseTO pb = (PostBattleResponseTO) obj;
			return pb.postData.equals(postData)
				&& pb.log.equals(log);
		}
		return false;
	}

	@Override
	public String toString() {
		StringBuffer sb = new StringBuffer();
		int i = 0;
    	for (Object para : log) {
    		sb.append("\t[" + (++i) + "] {" + para.getClass().getName() + "}=" + para.toString() + "\n");
    	}
		return "PostBattleResponseTO: postData=" + postData
			+ ", log=" + sb.toString();
	}

	public void destroyLog() {
		log.clear();
	}

	public void addPlayerEventMessage(String msg) {
		log.add(LOG_KEY_WORD_BATTLE_PLAYER_EVENT + msg);
	}
	
	public void addMonsterEventMessage(String msg) {
		log.add(LOG_KEY_WORD_BATTLE_MONSTER_EVENT + msg);
	}
	
	public void addAchievemntMessage(String msg) {
		log.add(LOG_KEY_WORD_BATTLE_ACHIEVEMENT + msg);
	}

	public CharacterPostDataTO getPostData() {
		return postData;
	}

	public void setPostData(CharacterPostDataTO postData) {
		this.postData = postData;
	}

	public List<String> getLog() {
		return log;
	}

	public void setLog(List<String> log) {
		this.log = log;
	}
	

}
